<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
		<title>CRM</title>
		<link rel="stylesheet" type="text/css" href="../static/azxcrm/css/wap/aui.css" th:href="@{/azxcrm/css/wap/aui.css}"/>
		<link rel="stylesheet" type="text/css" href="../static/azxcrm/css/wap/approve.css" th:href="@{/azxcrm/css/wap/approve.css}"/>
		<link rel="stylesheet" type="text/css" href="../static/azxcrm/css/wap/mui.min.css" th:href="@{/azxcrm/css/wap/mui.min.css}"/>
		<link rel="stylesheet" type="text/css" href="../static/azxcrm/css/wap/mui.picker.min.css" th:href="@{/azxcrm/css/wap/mui.picker.min.css}"/>
		<link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_835360_8flqp9ignrc.css"/>
		<script src="../static/azxcrm/js/wap/mui.min.js" th:src="@{/azxcrm/js/wap/mui.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../static/azxcrm/js/wap/mui.picker.min.js" th:src="@{/azxcrm/js/wap/mui.picker.min.js}" type="text/javascript" charset="utf-8"></script>
		<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
		<script th:inline="javascript"> var ctx = [[@{/}]]; </script>
	</head>
	<body>
	<!--头部结构-->	
    <header class="aui-bar aui-bar-nav">
		<a class="aui-pull-left aui-btn"  href="javascript:history.go(-1)">
		    <span class="iconfont icon-fanhui1"></span>返回
		</a>
		<div class="aui-title">审批详情</div>
	</header>
    <!--头部结构-->
    
    <!--审批详情结构-->
    <div class="aui-content aui-margin-b-15 aui-content-warp">
	    <ul class="aui-list aui-list-in">
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve">审批类型：</div>
	                <div class="s-approve-detail">退单</div>
	            </div>
	        </li>
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve">审批状态：</div>
	                <div class="s-approve-detail">待审批</div>
	            </div>
	        </li>
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve">订单编号：</div>
	                <div class="s-approve-detail" th:text="${order.orderNum}"></div>
	            </div>
	        </li>
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve">订单类型：</div>
	                <div class="s-approve-detail" th:text="${order.typeName}"></div>
	            </div>
	        </li>
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve">发起人：</div>
	                <div class="s-approve-detail" th:text="${order.salesUserName}"></div>
	            </div>
	        </li>
	    </ul>
	</div>
    <!--审批详情结构-->
    
     <!--退单结构-->
    <div class="aui-content aui-margin-b-15 g-approve">
	    <ul class="aui-list aui-list-in">
	        <li class="aui-list-item">
	            <div class="s-order">
	                <div class="s-approve"><span class="iconfont icon-gantanhao gantanhao"></span>退单说明：</div>
	                <div class="s-approve-detail" th:text="${order.refundReason}"></div>
	            </div>
	        </li>
	    </ul>
	</div>	
     <!--退单结构-->
    
    <!--退单流程结构-->
<!--     <div class="aui-content aui-margin-b-15 g-approve2">
	    <ul class="aui-list aui-list-in">
	        <li class="aui-list-item">
	            <div class="s-order">
	            	<div class="g-radius pos-rel"><span class="s-little-radius pos-ab"></span></div>
	                <div class="s-approve">发起人</div>
	                <div class="s-approve-detail" th:text="${order.salesUserName}"></div>
	                <div class="u-time" th:text="${order.updateTime}"></div>
	            </div>
	        </li>
	        <li class="g-line"></li>
	        <li class="aui-list-item">
	            <div class="s-order2">
	            	<div class="s-radius pos-rel"><span class="s-little-radius pos-ab"></span></div>
	                <div class="s-approve">部门主管</div>
	                <div class="s-approve-detail">张三<a class="s-wait">待审批</a></div>
	                <div class="u-time"></div>
	            </div>
	        </li>
	        <li class="g-line"></li>
	        <li class="aui-list-item">
	            <div class="s-order3">
	            	<div class="s-radius pos-rel"><span class="s-little-radius pos-ab"></span></div>
	                <div class="s-approve">部门主管</div>
	                <div class="s-approve-detail">张三<a class="s-wait">待审批</a></div>
	                <div class="u-time"></div>
	            </div>
	        </li>
	    </ul>
	</div>	 -->
	<form id="add_approve">
		<div class="aui-content aui-margin-b-15">
		    <ul class="aui-list aui-list-in">	      
		        <li class="aui-list-item aui-list-item-middle">
		            <div class="aui-list-item-inner aui-list-item-arrow">
		                <div class="aui-list-item-title">审批意见：</div>
		                <div class="aui-text" id="view" style="width: 61%;">请选择审批意见</div>
		                <input type="hidden" id="taskId" name="taskId" th:value="${taskId}">
		                <input type="hidden" id="audit" name="audit">
		            </div>    
		        </li>	       
		    </ul>
		</div>
		    <!--退单流程结构-->
	    <footer class="aui-bar aui-bar-tab" id="footer">	
		        <button type="button" class="aui-bar-tab-label aui-bar aui-bar-tab" id="toastBtn" onclick="return check(this.form)">确认</button>       
		</footer>
	</form>
	</body>
</html>
<script type="text/javascript">
	var view = document.getElementById('view');
	var audit= document.getElementById('audit');
		var data= new mui.PopPicker();
			data.setData([{
						value: 'pass',
						text: '同意',
						
					}, {
						value: 'reject',
						text: '不同意',
					}
				])
		view.addEventListener('tap', function() {
			data.show(function(items) {
				view.innerText = items[0].text;
				audit.value=items[0].value;
				//返回 false 可以阻止选择框的关闭
				//return false;
			});
		}, false);
	    
		function check(form) {			
	       	   if(view.innerText=='审批意见/同意'){
	               mui.toast('请选择审批意见');
	                 return false;
	       	   }else{
	            	$.ajax({
	         		cache : true,
	         		type : "POST",
	         		url : ctx + "/wap/saveApprove",
	         		data : $("#add_approve").serialize(),
	         		async : false,
	         		error : function(request) {
	         			mui.toast("系统错误");
	         		},
	         		success : function(data) {
	         			if (data.code == 0) {
	         				mui.toast("添加成功"); 
	         				$("#toastBtn").removeAttr("onclick");
	         				setTimeout(function(){
	       		    	    	window.location.href= ctx + "wap/examineList"
	        		    	    },2200)
	         			} else {
	         				mui.toast("添加失败");
	         			}
	         		}
	         		});
	             }     
	       }
</script>
